<?php

namespace app\model;

use think\Model;

class CouponUsagerecords extends Model
{

    protected $connection = 'mysql';

    protected $pk = 'id';

    protected $name = 'coupon_usagerecords';

    public static function getCoupon($order_id)
    {
        $usagerecords = self::where('order_id', $order_id)->find();

        if ($usagerecords) {
            $data = CouponReceive::find($usagerecords->coupon_id)?->toArray();
        }

        return $data;
    }
}
